/**
 * @author Ahammer
 * @date 2009 05
 */

/*
 * This file is part of Iqm.
 * Copyright (c) 2010-2011 Helmut Ahammer
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package opgui;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.media.jai.ParameterBlockJAI;
import javax.media.jai.PlanarImage;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import main.IqmTools;
import main.Look;
import main.Manager;
import main.Tank;


public class IqmColDeconGUI  extends IqmOperatorJFrame
							 implements IqmOperatorGUIBuilder, ActionListener {

	private  ParameterBlockJAI    pb         = null;  //  @jve:decl-index=0:
	//public  ImgProcFuncJFrame       opGUIFrame = null;
	//private  IqmColDeconGUI 		opGUIFrame = null;  //actionPerformed events werden in dieser Klasse abgehandelt
		

	
	private  JRadioButtonMenuItem buttH_E					= null;
	private  JRadioButtonMenuItem buttH_E2					= null;
	private  JRadioButtonMenuItem buttH_DAB					= null;
	private  JRadioButtonMenuItem buttFeulgenLightGreen		= null;
	private  JRadioButtonMenuItem buttGiemsa				= null;	
	private  JRadioButtonMenuItem buttFastRed_FastBlue_DAB	= null;
	private  JRadioButtonMenuItem buttMethyl_Green_DAB		= null;
	private  JRadioButtonMenuItem buttH_E_DAB				= null;
	private  JRadioButtonMenuItem buttH_AEC					= null;
	private  JRadioButtonMenuItem buttAcan_Mallory			= null;
	private  JRadioButtonMenuItem buttMassonTrichrome		= null;
	private  JRadioButtonMenuItem buttAlcian_blue_H			= null;
	private  JRadioButtonMenuItem buttH_PAS					= null;
	private  JRadioButtonMenuItem buttDAB_NBTBCIP			= null;
	private  JRadioButtonMenuItem buttDAB					= null;
	private  JRadioButtonMenuItem buttRGB					= null;
	private  JRadioButtonMenuItem buttCMY					= null;
	private  JRadioButtonMenuItem buttUser					= null;	
	private  JRadioButtonMenuItem buttColDeconHidden		= null;	
	private  JToolBar 			  jToolBarColDecon	  		= null;
	private  ButtonGroup 		  buttGroupColDecon			= null;
	
	/**
	 * constructor
	 */
	public IqmColDeconGUI() {

	}

	
	/**
	 * This method sets all  variables to null
	 */
	private void resetVariables(){
		pb         = null; 
		//opGUIFrame = null; 
		
		//jToolBarRGB  = null;

	}
	/**
	 * This method sets all parameters to null
	 */
	private void resetParameters(){
		//butt       = null;
		//butt       = null;
	}

	/**
	 * This method sets the current parameter block to the argument
	 * @param ParameterBlockJAI pb
	 */
	@Override
	public void setParameterBlock(ParameterBlockJAI arg){
		pb = arg;
		IqmTools.setCurrParameterBlockJAI(pb);	
	}
	/**
	 * This method sets the current parameter block
	 * The individual values of the GUI  current ParameterBlock
	 *
	 */
	@Override
	public void setParameterBlock(){
	
		if (buttH_E.isSelected())     				pb.setParameter("ColDecon", 0);
		if (buttH_E2.isSelected())     				pb.setParameter("ColDecon", 1);
		if (buttH_DAB.isSelected())     			pb.setParameter("ColDecon", 2);
		if (buttFeulgenLightGreen.isSelected())     pb.setParameter("ColDecon", 3);
		if (buttGiemsa.isSelected())     			pb.setParameter("ColDecon", 4);
		if (buttFastRed_FastBlue_DAB.isSelected())  pb.setParameter("ColDecon", 5);
		if (buttMethyl_Green_DAB.isSelected())      pb.setParameter("ColDecon", 6);
		if (buttH_E_DAB.isSelected())     		    pb.setParameter("ColDecon", 7);
		if (buttH_AEC.isSelected())     			pb.setParameter("ColDecon", 8);
		if (buttAcan_Mallory.isSelected())     		pb.setParameter("ColDecon", 9);
		if (buttMassonTrichrome.isSelected())     	pb.setParameter("ColDecon", 10);
		if (buttAlcian_blue_H.isSelected())     	pb.setParameter("ColDecon", 11);
		if (buttH_PAS.isSelected())     			pb.setParameter("ColDecon", 12);
		if (buttDAB_NBTBCIP.isSelected())     		pb.setParameter("ColDecon", 13);
		if (buttDAB.isSelected())     				pb.setParameter("ColDecon", 14);
		if (buttRGB.isSelected())     				pb.setParameter("ColDecon", 15);
		if (buttCMY.isSelected())     				pb.setParameter("ColDecon", 16);
		if (buttUser.isSelected())     				pb.setParameter("ColDecon", 17);	
		IqmTools.setCurrParameterBlockJAI(pb);	
	}
	
	/**
	 * This method sets the current parameter values
	 *
	 */
	@Override
	public void setParameterValues(){
		int idx = IqmTools.getCurrManagerImgIndex();
	    PlanarImage pi = Tank.getCurrentTankImageAt(idx); 
	       if (pi == null){
	    	   System.out.println("IqmColDeconGUI: Current image not defined");
	    	   return;
	       }

		if (pb.getIntParameter("ColDecon") == 0)     buttH_E.setSelected(true);
		if (pb.getIntParameter("ColDecon") == 1)     buttH_E2.setSelected(true);
	    if (pb.getIntParameter("ColDecon") == 2)     buttH_DAB.setSelected(true);
	    if (pb.getIntParameter("ColDecon") == 3)     buttFeulgenLightGreen.setSelected(true);
	    if (pb.getIntParameter("ColDecon") == 4)     buttGiemsa.setSelected(true);
	    if (pb.getIntParameter("ColDecon") == 5)     buttFastRed_FastBlue_DAB.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 6)     buttMethyl_Green_DAB.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 7)     buttH_E_DAB.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 8)     buttH_AEC.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 9)     buttAcan_Mallory.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 10)    buttMassonTrichrome.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 11)    buttAlcian_blue_H.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 12)    buttH_PAS.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 13)    buttDAB_NBTBCIP.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 14)    buttDAB.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 15)    buttRGB.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 16)    buttCMY.setSelected(true);
        if (pb.getIntParameter("ColDecon") == 17)    buttUser.setSelected(true);
	}

	/**
	 * This method creates and shows the GUI
	 */
	@Override
	public void createIqmOperatorGUI() {
		//System.out.println("IqmColDecon: createAndShowGUI invoked");
		//opGUIFrame = new IqmColDeconGUI();      //actionPerforemd events werden in dieser Klasse abgehandelt
		//opGUIFrame.getJContentPane();
		this.initialize(); //Aufruf von ImgProcFuncJFrame
		this.setTitle("ColDecon");
		//PlanarImage pi = Tank.getCurrentTankImageAt(IqmTools.getCurrManagerImgIndex());
		//Dimension dim = this.getSize();
		//this.setSize(dim.width, dim.height+280);
		//this.setPreferredSize(new Dimension(800, 600));

		this.getJContentPane().add(getJToolBarColDecon(),      getGridBagConstraintsColDecon());
	
		this.pack();
		//this.repaint();
		if (pb == null) pb = new ParameterBlockJAI("iqmColDecon");  //nur wenn das erste mal aufgerufen
		//pb = new ParameterBlockJAI("iqmthreshold"); //immer der default Block
		IqmTools.setCurrParameterBlockJAI(pb);
		this.setParameterValues();
	
	}


	private  GridBagConstraints getGridBagConstraintsColDecon(){
		GridBagConstraints gridBagConstraintsColDecon = new GridBagConstraints();
		gridBagConstraintsColDecon.gridx = 1;
		gridBagConstraintsColDecon.gridy = 5;
		gridBagConstraintsColDecon.gridwidth = 3;
		gridBagConstraintsColDecon.insets = new Insets(15,0,20,0);
		//gridBagConstraintsColDecon.anchor = GridBagConstraints.LINE_START;
		//gridBagConstraintsColDecon.fill = GridBagConstraints.BOTH;
		return gridBagConstraintsColDecon;
	}
	//------------------------------------------------------------------------------------------------------------------
	/**
	 * This method closes and destroys the GUI
	 * 
	 * @return void
	 */
//	public void destroyGUI() {
//		if (this != null){
//					
//			//this.closeAndDestroyGUI();
//			//resetVariables();
//			//folgendes geht auch!?
//			this.setVisible(false);
//			this.dispose();
//			//this = null;
//		}
//	}
	/**
	 * This method updates the GUI
	 * This method overrides IqmOperatorJFrame
	 */
	@Override
	public void updateIqmOperatorGUI(){
	
	}


	/**
	 * This method initializes the Option: H_E
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_E() {
		if (buttH_E == null) {
			buttH_E  = new JRadioButtonMenuItem();
			buttH_E.setText("H&E");
			buttH_E.setToolTipText("H&E");
			buttH_E.addActionListener(this);
			buttH_E.setActionCommand("parameter");
		}
		return buttH_E;
	}
	/**
	 * This method initializes the Option: H_E2
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_E2() {
		if (buttH_E2 == null) {
			buttH_E2  = new JRadioButtonMenuItem();
			buttH_E2.setText("H&E2");
			buttH_E2.setToolTipText("H&E2");
			buttH_E2.addActionListener(this);
			buttH_E2.setActionCommand("parameter");
		}
		return buttH_E2;
	}
	/**
	 * This method initializes the Option: H_DAB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_DAB() {
		if (buttH_DAB == null) {
			buttH_DAB  = new JRadioButtonMenuItem();
			buttH_DAB.setText("H DAB");
			buttH_DAB.setToolTipText("H DAB");
			buttH_DAB.addActionListener(this);
			buttH_DAB.setActionCommand("parameter");
		}
		return buttH_DAB;
	}
	/**
	 * This method initializes the Option: FeulgenLightGreen
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonFeulgenLightGreen() {
		if (buttFeulgenLightGreen == null) {
			buttFeulgenLightGreen  = new JRadioButtonMenuItem();
			buttFeulgenLightGreen.setText("Feulgen Light Green");
			buttFeulgenLightGreen.setToolTipText("Feulgen Light Green");
			buttFeulgenLightGreen.addActionListener(this);
			buttFeulgenLightGreen.setActionCommand("parameter");
		}
		return buttFeulgenLightGreen;
	}
	/**
	 * This method initializes the Option: Giemsa
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonGiemsa() {
		if (buttGiemsa == null) {
			buttGiemsa  = new JRadioButtonMenuItem();
			buttGiemsa.setText("Giemsa");
			buttGiemsa.setToolTipText("Giemsa");
			buttGiemsa.addActionListener(this);
			buttGiemsa.setActionCommand("parameter");
		}
		return buttGiemsa;
	}
	/**
	 * This method initializes the Option: FastRed_FastBlue_DAB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonFastRed_FastBlue_DAB() {
		if (buttFastRed_FastBlue_DAB == null) {
			buttFastRed_FastBlue_DAB  = new JRadioButtonMenuItem();
			buttFastRed_FastBlue_DAB.setText("FastRed FastBlue DAB");
			buttFastRed_FastBlue_DAB.setToolTipText("FastRed FastBlue DAB");
			buttFastRed_FastBlue_DAB.addActionListener(this);
			buttFastRed_FastBlue_DAB.setActionCommand("parameter");
		}
		return buttFastRed_FastBlue_DAB;
	}
	/**
	 * This method initializes the Option: Methyl_Green_DAB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonMethyl_Green_DAB() {
		if (buttMethyl_Green_DAB == null) {
			buttMethyl_Green_DAB  = new JRadioButtonMenuItem();
			buttMethyl_Green_DAB.setText("Methyl Green DAB");
			buttMethyl_Green_DAB.setToolTipText("Methyl Green DAB");
			buttMethyl_Green_DAB.addActionListener(this);
			buttMethyl_Green_DAB.setActionCommand("parameter");
		}
		return buttMethyl_Green_DAB;
	}
	/**
	 * This method initializes the Option: H_E_DAB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_E_DAB() {
		if (buttH_E_DAB == null) {
			buttH_E_DAB  = new JRadioButtonMenuItem();
			buttH_E_DAB.setText("H&E DAB");
			buttH_E_DAB.setToolTipText("H&E DAB");
			buttH_E_DAB.addActionListener(this);
			buttH_E_DAB.setActionCommand("parameter");
			buttH_E_DAB.setEnabled(true);
		}
		return buttH_E_DAB;
	}
	/**
	 * This method initializes the Option: H_AEC
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_AEC() {
		if (buttH_AEC == null) {
			buttH_AEC  = new JRadioButtonMenuItem();
			buttH_AEC.setText("H AEC");
			buttH_AEC.setToolTipText("H AEC");
			buttH_AEC.addActionListener(this);
			buttH_AEC.setActionCommand("parameter");
			buttH_AEC.setEnabled(true);
		}
		return buttH_AEC;	
	}
	/**
	 * This method initializes the Option: Acan_Mallory
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonAcan_Mallory() {
		if (buttAcan_Mallory == null) {
			buttAcan_Mallory  = new JRadioButtonMenuItem();
			buttAcan_Mallory.setText("Acan Mallory");
			buttAcan_Mallory.setToolTipText("Acan Mallory");
			buttAcan_Mallory.addActionListener(this);
			buttAcan_Mallory.setActionCommand("parameter");
			buttAcan_Mallory.setEnabled(true);
		}
		return buttAcan_Mallory;	
	}
	/**
	 * This method initializes the Option: MassonTrichrome
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonMassonTrichrome() {
		if (buttMassonTrichrome == null) {
			buttMassonTrichrome  = new JRadioButtonMenuItem();
			buttMassonTrichrome.setText("Masson Trichrome");
			buttMassonTrichrome.setToolTipText("Masson Trichrome");
			buttMassonTrichrome.addActionListener(this);
			buttMassonTrichrome.setActionCommand("parameter");
			buttMassonTrichrome.setEnabled(true);
		}
		return buttMassonTrichrome;	
	}
	/**
	 * This method initializes the Option: Alcian_blue_H
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonAlcian_blue_H() {
		if (buttAlcian_blue_H == null) {
			buttAlcian_blue_H  = new JRadioButtonMenuItem();
			buttAlcian_blue_H.setText("Alcian blue H");
			buttAlcian_blue_H.setToolTipText("Alcian blue H");
			buttAlcian_blue_H.addActionListener(this);
			buttAlcian_blue_H.setActionCommand("parameter");
			buttAlcian_blue_H.setEnabled(true);
		}
		return buttAlcian_blue_H;	
	}
	/**
	 * This method initializes the Option: H_PAS
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonH_PAS() {
		if (buttH_PAS == null) {
			buttH_PAS  = new JRadioButtonMenuItem();
			buttH_PAS.setText("H PAS");
			buttH_PAS.setToolTipText("H PAS");
			buttH_PAS.addActionListener(this);
			buttH_PAS.setActionCommand("parameter");
			buttH_PAS.setEnabled(true);
		}
		return buttH_PAS;	
	}
	/**
	 * This method initializes the Option: DAB_NBTBCIP
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonDAB_NBTBCIP() {
		if (buttDAB_NBTBCIP == null) {
			buttDAB_NBTBCIP  = new JRadioButtonMenuItem();
			buttDAB_NBTBCIP.setText("DAB NBTBCIP");
			buttDAB_NBTBCIP.setToolTipText("DAB NBTBCIP");
			buttDAB_NBTBCIP.addActionListener(this);
			buttDAB_NBTBCIP.setActionCommand("parameter");
			buttDAB_NBTBCIP.setEnabled(true);
		}
		return buttDAB_NBTBCIP;	
	}
	/**
	 * This method initializes the Option: DAB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonDAB() {
		if (buttDAB == null) {
			buttDAB  = new JRadioButtonMenuItem();
			buttDAB.setText("DAB");
			buttDAB.setToolTipText("DAB");
			buttDAB.addActionListener(this);
			buttDAB.setActionCommand("parameter");
			buttDAB.setEnabled(true);
		}
		return buttDAB;	
	}
	/**
	 * This method initializes the Option: RGB
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonRGB() {
		if (buttRGB == null) {
			buttRGB  = new JRadioButtonMenuItem();
			buttRGB.setText("RGB");
			buttRGB.setToolTipText("RGB");
			buttRGB.addActionListener(this);
			buttRGB.setActionCommand("parameter");
			buttRGB.setEnabled(true);
		}
		return buttRGB;	
	}
	/**
	 * This method initializes the Option: CMY
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonCMY() {
		if (buttCMY == null) {
			buttCMY  = new JRadioButtonMenuItem();
			buttCMY.setText("CMY");
			buttCMY.setToolTipText("CMY");
			buttCMY.addActionListener(this);
			buttCMY.setActionCommand("parameter");
			buttCMY.setEnabled(true);
		}
		return buttCMY;	
	}
	/**
	 * This method initializes the Option: User
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonUser() {
		if (buttUser == null) {
			buttUser  = new JRadioButtonMenuItem();
			buttUser.setText("User");
			buttUser.setToolTipText("User");
			buttUser.addActionListener(this);
			buttUser.setActionCommand("parameter");
			buttUser.setEnabled(true);
		}
		return buttUser;	
	}

	/**
	 * This method initializes the hidden Button option	
	 * 	
	 * @return javax.swing.JRadioButtonMenuItem	
	 */
	private  JRadioButtonMenuItem getJRadioButtonColDeconHidden() {
		//if (buttColDeconHidden == null) {
			buttColDeconHidden  = new JRadioButtonMenuItem();
			buttColDeconHidden.setText("Hidden");
			buttColDeconHidden.setVisible(false);
		//}
		return buttColDeconHidden;
	}
	/**
	 * This method initializes jJToolBarBar	
	 * 	
	 * @return javax.swing.JToolBar	
	 */
	private   JToolBar getJToolBarColDecon() {
//		if (jToolBarColDecon == null) {
			jToolBarColDecon = new JToolBar("ColDecon");
			jToolBarColDecon.setOrientation(1); //Vertical orientation
			jToolBarColDecon.add(getJRadioButtonH_E());			
			jToolBarColDecon.add(getJRadioButtonH_E2());			
			jToolBarColDecon.add(getJRadioButtonH_DAB());			
			jToolBarColDecon.add(getJRadioButtonFeulgenLightGreen());			
			jToolBarColDecon.add(getJRadioButtonGiemsa());			
			jToolBarColDecon.add(getJRadioButtonFastRed_FastBlue_DAB());			
			jToolBarColDecon.add(getJRadioButtonMethyl_Green_DAB());
			jToolBarColDecon.add(getJRadioButtonH_E_DAB());			
			jToolBarColDecon.add(getJRadioButtonH_AEC());
			jToolBarColDecon.add(getJRadioButtonAcan_Mallory());
			jToolBarColDecon.add(getJRadioButtonMassonTrichrome());
			jToolBarColDecon.add(getJRadioButtonAlcian_blue_H());
			jToolBarColDecon.add(getJRadioButtonH_PAS());
			jToolBarColDecon.add(getJRadioButtonDAB_NBTBCIP());
			jToolBarColDecon.add(getJRadioButtonDAB());
			jToolBarColDecon.add(getJRadioButtonRGB());
			jToolBarColDecon.add(getJRadioButtonCMY());
			jToolBarColDecon.add(getJRadioButtonUser());
			jToolBarColDecon.add(getJRadioButtonColDeconHidden());
			//jToolBarColDecon.addSeparator();
			this.setButtonGroupColDecon();	//Gruppieren der JRadioButtons
//		}
		return jToolBarColDecon;
	}
	private  void setButtonGroupColDecon() {
		//if (ButtonGroup buttGroupColDecon == null) {
			buttGroupColDecon = new ButtonGroup();
			buttGroupColDecon.add(buttH_E);
			buttGroupColDecon.add(buttH_E2);
			buttGroupColDecon.add(buttH_DAB);
			buttGroupColDecon.add(buttFeulgenLightGreen);
			buttGroupColDecon.add(buttGiemsa);
			buttGroupColDecon.add(buttFastRed_FastBlue_DAB);
			buttGroupColDecon.add(buttMethyl_Green_DAB);
			buttGroupColDecon.add(buttH_E_DAB);
			buttGroupColDecon.add(buttH_AEC);
			buttGroupColDecon.add(buttAcan_Mallory);
			buttGroupColDecon.add(buttMassonTrichrome);
			buttGroupColDecon.add(buttAlcian_blue_H);
			buttGroupColDecon.add(buttH_PAS);
			buttGroupColDecon.add(buttDAB_NBTBCIP);
			buttGroupColDecon.add(buttDAB);
			buttGroupColDecon.add(buttRGB);
			buttGroupColDecon.add(buttCMY);
			buttGroupColDecon.add(buttUser);
			buttGroupColDecon.add(buttColDeconHidden);		
		}


	
	//--------------------------------------------------------------------------------------------
	public void actionPerformed(ActionEvent e) {
		//System.out.println("IqmColDeconGUI: event e: " +e.getActionCommand());
		if ("reset".equals(e.getActionCommand())) {
			ParameterBlockJAI pb = new ParameterBlockJAI("IqmColDecon".toLowerCase());
			IqmTools.setCurrParameterBlockJAI(pb);
			this.setParameterBlock(pb);
			//this.setParameterValues();
			this.updateIqmOperatorGUI();  //if necessary here or some lines above
			this.reset();
		}
		if ("parameter".equals(e.getActionCommand())) {
			this.setParameterBlock();
			//this.updateIqmOperatorGUI();  //if necessary here or some lines above
		}
	
		//preview if selected
		if (this.isAutoPreviewSelected()){
			this.showPreview();
		}

	}

	//-------------------------------------------------------------------------------------------------
	public static void main() {

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				IqmColDeconGUI gui = new IqmColDeconGUI();
				gui.createIqmOperatorGUI();

			}
		});
	}



	
}//END
